test: replace removed CliRunner.isolated_filesystem with tmp_path#703
Merged
Conversation
Click's CliRunner dropped the isolated_filesystem() context manager in the version now resolved, so test_associate_assets_command_calls_service failed with AttributeError. Replace it with the pytest tmp_path fixture, matching the pattern used by other tests in this file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the CLI command test suite to accommodate a Click/Typer upgrade where CliRunner.isolated_filesystem() is no longer available, ensuring associate-assets tests continue to run reliably.
Changes:
- Replaced use of
CliRunner.isolated_filesystem()with pytest’stmp_pathfixture intest_associate_assets_command_calls_service. - Creates the expected
asset_import_batchdirectory undertmp_pathbefore invoking the CLI command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
test_associate_assets_command_calls_servicefails:AttributeError: 'CliRunner' object has no attribute 'isolated_filesystem'CliRunnerdropped theisolated_filesystem()context manager in the version now resolved.How
tmp_pathfixture to create theasset_import_batchdir, matching the pattern other tests in this file already use (tests/test_cli_commands.py:257).textwrap.dedentblock intest_water_levels_cli_persists_observations(pre-existing format drift the pre-commit hook fixed).Notes
.env; CI exercises it.